package com.gitee.api;

import com.gitee.walmart.WalmartClient;
import com.gitee.walmart.vo.WalmartOrder;
import com.gitee.walmart.vo.WalmartToken;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by EalenXie on 2022/2/14 11:10
 */
@RestController
public class SayHelloController {


    private final WalmartClient walmartClient = new WalmartClient();


    @GetMapping("/say")
    public WalmartOrder sayHello() {

        String clientId="9a42266f-bb91-4860-923f-53f2b17b746d";
        String clientSe="L9Y6B8lfU2WSfgszxy8MuUNJVAhfD5_Hk9RoPUx6Q0nHTzXAXkR4BPzSRL1jKSOP54jP57lu9pnh-07Gylie3w";


        ResponseEntity<WalmartToken> walmartTokenResponseEntity = walmartClient.accessToken(clientId, clientSe);



        return walmartClient.order(clientId, clientSe, walmartTokenResponseEntity.getBody().getAccessToken(), "7870762878697").getBody();

    }
}
